home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / java / net / JarURLConnection.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.9 KB  |  71 lines

  1. package java.net;
  2.  
  3. import java.io.IOException;
  4. import java.security.cert.Certificate;
  5. import java.util.jar.Attributes;
  6. import java.util.jar.JarEntry;
  7. import java.util.jar.JarFile;
  8. import java.util.jar.Manifest;
  9. import sun.net.www.ParseUtil;
  10.  
  11. public abstract class JarURLConnection extends URLConnection {
  12.    private URL jarFileURL;
  13.    private String entryName;
  14.    protected URLConnection jarFileURLConnection;
  15.  
  16.    protected JarURLConnection(URL var1) throws MalformedURLException {
  17.       super(var1);
  18.       this.parseSpecs(var1);
  19.    }
  20.  
  21.    private void parseSpecs(URL var1) throws MalformedURLException {
  22.       String var2 = var1.getFile();
  23.       int var3 = var2.indexOf("!/");
  24.       if (var3 == -1) {
  25.          throw new MalformedURLException("no !/ found in url spec:" + var2);
  26.       } else {
  27.          this.jarFileURL = new URL(var2.substring(0, var3++));
  28.          this.entryName = null;
  29.          ++var3;
  30.          if (var3 != var2.length()) {
  31.             this.entryName = var2.substring(var3, var2.length());
  32.             this.entryName = ParseUtil.decode(this.entryName);
  33.          }
  34.  
  35.       }
  36.    }
  37.  
  38.    public URL getJarFileURL() {
  39.       return this.jarFileURL;
  40.    }
  41.  
  42.    public String getEntryName() {
  43.       return this.entryName;
  44.    }
  45.  
  46.    public abstract JarFile getJarFile() throws IOException;
  47.  
  48.    public Manifest getManifest() throws IOException {
  49.       return this.getJarFile().getManifest();
  50.    }
  51.  
  52.    public JarEntry getJarEntry() throws IOException {
  53.       return this.getJarFile().getJarEntry(this.entryName);
  54.    }
  55.  
  56.    public Attributes getAttributes() throws IOException {
  57.       JarEntry var1 = this.getJarEntry();
  58.       return var1 != null ? var1.getAttributes() : null;
  59.    }
  60.  
  61.    public Attributes getMainAttributes() throws IOException {
  62.       Manifest var1 = this.getManifest();
  63.       return var1 != null ? var1.getMainAttributes() : null;
  64.    }
  65.  
  66.    public Certificate[] getCertificates() throws IOException {
  67.       JarEntry var1 = this.getJarEntry();
  68.       return var1 != null ? var1.getCertificates() : null;
  69.    }
  70. }
  71.